function fn(n: number): number {
  return n;
}

function fn2(n: any): any {
  return n;
}

function fn3<T>(n: T): T {
  console.log("admin".length);

  console.log(n);
  return n;
}
fn3<number>(3);
fn3<string>("admin");

function fn4<T>(n: T[]): T[] {
  console.log(n.length);

  // console.log(n.length);
  return n;
}
fn4<string>(["admin", "123", "kkk"]);

interface K {
  length: number;
}
function fn5<T extends K>(n: T): T {
  console.log(n.length);
  // console.log(n.length);
  return n;
}
fn5<Array<string>>(["admin", ""]);

function fn6<V, T extends K>(x: V, y: T): void {
  console.log(x, y);
}
fn6<string, string>("admin", "8");

function getProp<T, K extends keyof T>(obj: T, key: K): void {
  console.log(obj[key]);
}

class Person {
  name: string;
  age: number;
}
let p: Person = {
  name: "张三",
  age: 20,
};
getProp(p, "age");
